import request from "@/utils/request";

const urlMiddlePath = "/business/products/";

// 创建产品
export function createProductApi(data) {
  return request({
    url: urlMiddlePath + "create",
    method: "post",
    data,
  });
}

// 查询所有产品
export function getProductListApi(params) {
  return request({
    url: urlMiddlePath + "list",
    method: "get",
    params,
  });
}

// 查询单个产品
export function getProductInfoByIdApi(id) {
  return request({
    url: urlMiddlePath + `getInfoById?id=${id}`,
    method: "get",
  });
}

// 更新产品
export function updateProductInfoByIdApi(id, data) {
  return request({
    url: urlMiddlePath + `updateInfoById?id=${id}`,
    method: "post",
    data,
  });
}

// 删除产品
export function deleteProductInfoByIdApi(id) {
  return request({
    url: urlMiddlePath + `delete?id=${id}`,
    method: "get",
  });
}
